# Python 2.6.4
# Project Euler, Problem 40
# Copyright 2010 Talha Zaman

digits = ""
i = 0
while len(digits)<1000001:
    digits += str(i)
    i += 1
r = [10**x for x in range(0,7)]
prod = 1
for i in r: prod *= int(digits[i])
print prod
